﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InfoTech.Core.Data.SqlClient;
using InfoTech.LanTranh.MucVu.Bussiness;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            InfoTech.Core.Service.BaseService.InitialConnection(@"Data Source=112.213.89.94;Initial Catalog=GiaoXuLanTranh_MucVu;uid=lantranh_admin;pwd=@#lantranh*();");
            foreach (HOGIADINH hogiadinh in InfoTech.Core.Data.Receiver.TypeObject<HOGIADINH>.Select())
            {
                HOGIADINH_DIACHI hogiadinhDiachi = new HOGIADINH_DIACHI();
                hogiadinhDiachi.MAHOGIADINH = hogiadinh.MAHOGIADINH;
                hogiadinhDiachi.MAQUOCGIA = hogiadinhDiachi.MAQUOCGIA;
                hogiadinhDiachi.MATINHTHANH = hogiadinhDiachi.MATINHTHANH;
                hogiadinhDiachi.MAQUANHUYEN = hogiadinhDiachi.MAQUANHUYEN;
                hogiadinhDiachi.MAXAPHUONG = hogiadinh.MAXAPHUONG;
                hogiadinhDiachi.MAGIAOPHAN = hogiadinh.MAGIAOPHAN;
                hogiadinhDiachi.MAGIAOHAT = hogiadinh.MAGIAOHAT;
                hogiadinhDiachi.MAGIAOXU = hogiadinh.MAGIAOXU;
                hogiadinhDiachi.MAGIAOHO = hogiadinh.MAGIAOHO;
                hogiadinhDiachi.DIACHI = hogiadinh.DIACHI;
                hogiadinhDiachi.TUTHANG = 1;
                hogiadinhDiachi.TUNAM = 2010;
                Exception exception;
                hogiadinhDiachi.Insert(out exception);
                if(exception!=null)
                {
                    Console.WriteLine(exception.Message);
                }
            }
            Console.ReadLine();
        }
    }
}
